<script>
    var wsServer = 'ws://192.168.35.130:9443/';
    var websocket = new WebSocket(wsServer);
    //活动ID
    var activeId = 1;
    var userId = 'ogKdPt-LQTpRjBSRQYEZwNN2dGE4';
    var winNum = 200;
    var expireTime = '2017-07-27';
    websocket.onopen = function (evt) {
        console.log("Connected to WebSocket server.");
        var data = '<?php echo json_encode(array('type'=>'login','username'=>$userinfo['nickname'],'picture'=>$userinfo['picture'],'openid'=>$openid,
            'round_id'=>$activeinfo['id'],'active_id'=>$activeinfo['activity_id'],'is_LED'=>0,
            'win_num'=>$activeinfo['win_num'], 'expire_at'=>$activeinfo['expire_at'],'api_url'=>Config::WORKMAN_APIURL));?>';
        ws.send(data);
    };

    websocket.onclose = function (evt) {
        console.log("Disconnected");
    };

    websocket.onmessage = function (evt) {
        console.log('Retrieved data from server: ' + evt.data);
    };

    websocket.onerror = function (evt, e) {
        console.log('Error occured: ' + evt.data);
    };
</script>